package com.landinfo.service.impl;

import com.landinfo.service.FlyToLineService;
import com.landinfo.domain.FlyToLine;
import com.landinfo.repository.FlyToLineRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Service Implementation for managing FlyToLine.
 */
@Service
@Transactional
public class FlyToLineServiceImpl implements FlyToLineService{

    private final Logger log = LoggerFactory.getLogger(FlyToLineServiceImpl.class);

    private final FlyToLineRepository flyToLineRepository;

    public FlyToLineServiceImpl(FlyToLineRepository flyToLineRepository) {
        this.flyToLineRepository = flyToLineRepository;
    }

    /**
     * Save a flyToLine.
     *
     * @param flyToLine the entity to save
     * @return the persisted entity
     */
    @Override
    public FlyToLine save(FlyToLine flyToLine) {
        log.debug("Request to save FlyToLine : {}", flyToLine);
        return flyToLineRepository.save(flyToLine);
    }

    /**
     * Get all the flyToLines.
     *
     * @return the list of entities
     */
    @Override
    @Transactional(readOnly = true)
    public List<FlyToLine> findAll() {
        log.debug("Request to get all FlyToLines");
        return flyToLineRepository.findAll();
    }

    /**
     * Get one flyToLine by id.
     *
     * @param id the id of the entity
     * @return the entity
     */
    @Override
    @Transactional(readOnly = true)
    public FlyToLine findOne(Long id) {
        log.debug("Request to get FlyToLine : {}", id);
        return flyToLineRepository.findById(id).get();
    }

    /**
     * Delete the flyToLine by id.
     *
     * @param id the id of the entity
     */
    @Override
    public void delete(Long id) {
        log.debug("Request to delete FlyToLine : {}", id);
        flyToLineRepository.deleteById(id);
    }
}
